package com.yyg.boot.web;

import com.yyg.boot.exception.CustomException;
import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description Description
 * @Author 一一哥Sun
 * @Date Created in 2020/3/27
 */
@Controller
public class HelloController {

    @ResponseBody
    @GetMapping("/show")
    public String showMsg() {
        return "success";
    }

    @GetMapping("/showError")
    public void showError() {
        throw new RuntimeException("自定义异常...");
    }

    @RequestMapping("/json")
    public String handleJsonException() throws CustomException {
        throw new CustomException("json格式的异常处理方案...");
    }

}
